cmake_minimum_required(VERSION 3.27)
project(KV_Raft)

# 设置C++标准
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 包含raft框架
add_subdirectory(raft)

# Boost库
find_package(Boost CONFIG REQUIRED)

add_executable(KV_Raft main.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/skip_list/DataStream.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/service/utils/KVCommand.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/service/state_machine/KVStateMachine.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/service/state_machine/KVStateGrpc.cpp 
    ${CMAKE_CURRENT_SOURCE_DIR}/service/middleware/KVMiddleware.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/service/middleware/Session.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/service/middleware/Server.cpp
)

target_include_directories(KV_Raft PRIVATE
    # raft 框架头文件
    ${CMAKE_CURRENT_SOURCE_DIR}/raft/include

    # 项目头文件
    ${CMAKE_CURRENT_SOURCE_DIR}/service/include/utils
    ${CMAKE_CURRENT_SOURCE_DIR}/service/include/state_machine
    ${CMAKE_CURRENT_SOURCE_DIR}/service/include/middleware
    ${CMAKE_CURRENT_SOURCE_DIR}/skip_list/include
)

target_link_libraries(KV_Raft PRIVATE
    Raft
    Boost::boost
)